﻿using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Mvc.RazorTools.FontAwesome.Tests
{
	[TestClass]
	public class HtmlExtensionsTests
	{
		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		public void HtmlFontAwesomeTest1()
		{
			ViewContext vc = new ViewContext();
			ViewData data = new ViewData();
			HtmlHelper html = new HtmlHelper(vc, data);

			MvcHtmlString result = html.FontAwesome(FontAwesomeIconSet.Flag);
			Assert.AreEqual("<i class=\"fa fa-flag\"></i>", result.ToString());
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		public void HtmlFontAwesomeTest2()
		{
			ViewContext vc = new ViewContext();
			ViewData data = new ViewData();
			HtmlHelper html = new HtmlHelper(vc, data);

			MvcHtmlString result = html.FontAwesome(FontAwesomeIconSet.Flag, "value1", "value2", "value3");
			Assert.AreEqual("<i class=\"fa fa-flag value1 value2 value3\"></i>", result.ToString());
		}

		[TestMethod]
		[ExpectedException(typeof(ArgumentNullException))]
		public void HtmlFontAwesomeTest3()
		{
			HtmlHelper html = null;
			MvcHtmlString result = html.FontAwesome(FontAwesomeIconSet.Flag);
		}

		[TestMethod]
		[ExpectedException(typeof(ArgumentNullException))]
		public void HtmlFontAwesomeTest4()
		{
			ViewContext vc = new ViewContext();
			ViewData data = new ViewData();
			HtmlHelper html = new HtmlHelper(vc, data);

			MvcHtmlString result = html.FontAwesome(null);
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		public void HtmlFontAwesomeStackByListTest1()
		{
			ViewContext vc = new ViewContext();
			ViewData data = new ViewData();
			HtmlHelper html = new HtmlHelper(vc, data);

			MvcHtmlString result = html.FontAwesomeStack(
					new FontAwesomeIcon[] 
					{ 
						FontAwesomeIconSet.Star, 
						FontAwesomeIconSet.Flag 
					});

			Assert.AreEqual("<span class=\"fa-stack\"><i class=\"fa fa-star fa-stack-1x\"></i><i class=\"fa fa-flag fa-stack-1x\"></i></span>", result.ToString());
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		[ExpectedException(typeof(ArgumentNullException))]
		public void HtmlFontAwesomeStackByListTest2()
		{
			HtmlHelper html = null;
			MvcHtmlString result = html.FontAwesomeStack(new FontAwesomeIcon[] { FontAwesomeIconSet.Star, FontAwesomeIconSet.Flag });
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		[ExpectedException(typeof(ArgumentNullException))]
		public void HtmlFontAwesomeStackByListTest3()
		{
			ViewContext vc = new ViewContext();
			ViewData data = new ViewData();
			HtmlHelper html = new HtmlHelper(vc, data);

			IEnumerable<FontAwesomeIcon> items = null;
			MvcHtmlString result = html.FontAwesomeStack(items);
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		public void HtmlFontAwesomeStackByListTest4()
		{
			ViewContext vc = new ViewContext();
			ViewData data = new ViewData();
			HtmlHelper html = new HtmlHelper(vc, data);

			MvcHtmlString result = html.FontAwesomeStack(
					new FontAwesomeIcon[] 
					{ 
						FontAwesomeIconSet.Star, 
						FontAwesomeIconSet.Flag 
					},
					"value1", "value2", "value3");

			Assert.AreEqual("<span class=\"fa-stack value1 value2 value3\"><i class=\"fa fa-star fa-stack-1x\"></i><i class=\"fa fa-flag fa-stack-1x\"></i></span>", result.ToString());
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		public void HtmlFontAwesomeStackTest1()
		{
			ViewContext vc = new ViewContext();
			ViewData data = new ViewData();
			HtmlHelper html = new HtmlHelper(vc, data);

			FontAwesomeStack stack = new FontAwesomeStack(
						new FontAwesomeIcon[] 
						{ 
							FontAwesomeIconSet.Star, 
							FontAwesomeIconSet.Flag 
						});

			MvcHtmlString result = html.FontAwesomeStack(stack);
			Assert.AreEqual("<span class=\"fa-stack\"><i class=\"fa fa-star fa-stack-1x\"></i><i class=\"fa fa-flag fa-stack-1x\"></i></span>", result.ToString());
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		[ExpectedException(typeof(ArgumentNullException))]
		public void HtmlFontAwesomeStackTest2()
		{
			HtmlHelper html = null;
			MvcHtmlString result = html.FontAwesomeStack(new FontAwesomeIcon[] { FontAwesomeIconSet.Star, FontAwesomeIconSet.Flag });
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		[ExpectedException(typeof(ArgumentNullException))]
		public void HtmlFontAwesomeStackTest3()
		{
			ViewContext vc = new ViewContext();
			ViewData data = new ViewData();
			HtmlHelper html = new HtmlHelper(vc, data);

			FontAwesomeStack stack = null;
			MvcHtmlString result = html.FontAwesomeStack(stack);
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		public void HtmlFontAwesomeStackTest4()
		{
			ViewContext vc = new ViewContext();
			ViewData data = new ViewData();
			HtmlHelper html = new HtmlHelper(vc, data);

			Dictionary<string, string> classAttributes = new Dictionary<string, string>();
			classAttributes.Add("item1", "value1");
			classAttributes.Add("item2", "value2");
			classAttributes.Add("item3", "value3");

			FontAwesomeStack stack = new FontAwesomeStack(new FontAwesomeIcon[] 
						{
							FontAwesomeIconSet.Star, 
							FontAwesomeIconSet.Flag 
						},
						classAttributes);

			MvcHtmlString result = html.FontAwesomeStack(stack);
			Assert.AreEqual("<span class=\"fa-stack value1 value2 value3\"><i class=\"fa fa-star fa-stack-1x\"></i><i class=\"fa fa-flag fa-stack-1x\"></i></span>", result.ToString());
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		public void HtmlFontAwesomeStackTest5()
		{
			ViewContext vc = new ViewContext();
			ViewData data = new ViewData();
			HtmlHelper html = new HtmlHelper(vc, data);

			MvcHtmlString result = html.FontAwesomeStack(FontAwesomeIconSet.Star, FontAwesomeIconSet.Flag);
			Assert.AreEqual("<span class=\"fa-stack\"><i class=\"fa fa-star fa-stack-1x\"></i><i class=\"fa fa-flag fa-stack-1x\"></i></span>", result.ToString());
		}

		[TestMethod]
		[TestCategory("HtmlExtensionsTests")]
		[ExpectedException(typeof(ArgumentNullException))]
		public void HtmlFontAwesomeStackTest6()
		{
			HtmlHelper html = null;
			MvcHtmlString result = html.FontAwesomeStack(FontAwesomeIconSet.Star, FontAwesomeIconSet.Flag);
		}
	}
}
